package com.demo.utils;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * 通用的结果返回类
 * @param <T>
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResponseResult<T> implements Serializable {
 
    private Integer code;

    private String errorMessage;

    private T data;


    public static<T> ResponseResult success(T data){
        return new ResponseResult<>(0, "操作成功", data);
    }

    public static  ResponseResult error(String msg){
        return new ResponseResult(1,msg,null);
    }

}
